import { request } from "umi"

export function getKnowledgeList(payload:any) {
    let params = {
        page:payload.page,
        pageSize:payload.pageSize,
    }
    return request('/api/knowledge', {
        params
    })
}

// 上传文件
export function upload(payload:any) {
    return request(`/api/knowledge/book`, {
        method: "post",
        data:payload
    });
}

// 删除文件
export function KnowledgeDelete(id:string) {
    return request(`/api/knowledge/${id}`, {
        method: "delete",
    });
}
// 获取文件信息
export function KnowledgeDetail(id:string) {
    return request(`/api/knowledge/${id}`, {
        
    });
}

// 获取图片列表
export function getKnowledgeImgList(payload:any) {
    let params = {
        page:payload.page,
        pageSize:payload.pageSize,
    }
    return request('/api/file', {
        params
    })
}


// 改变文件发布状态
export function KnowledgeState(payload:any) {

    return request(`/api/knowledge/${payload.id}`, {
        method: "PATCH",
        data:{
            status:payload.state
        }
    });
}
